#include "ConfigMgr.h"

ConfigMgr *ConfigMgr::_instance;

ConfigMgr::ConfigMgr()
{
	Size visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();
	_resourceWidth = 720;
	_pieceSize = 80;
	_boardOrigin = Vec2(visibleSize.width / 2 - 315, visibleSize.height / 2 - 357);
}

ConfigMgr::~ConfigMgr()
{

}

ConfigMgr* ConfigMgr::getInstance()
{
	if (_instance == nullptr)
	{
		_instance = new ConfigMgr();
	}
	return _instance;
}

int ConfigMgr::getResourceWidth()
{
	return _resourceWidth;
}

float ConfigMgr::getPieceSize()
{
	return _pieceSize;
}

Vec2 ConfigMgr::getGLCoord(int x, int y)
{
	float absX = _boardOrigin.x + x*_pieceSize;
	float absY = _boardOrigin.y + y*_pieceSize;
	return Vec2(absX, absY);
}
